package com.ihr360.oneclick.vo;

import org.springframework.data.domain.Page;

import java.util.List;

/**
 * 分页数据
 *
 * @author tom
 * @date 17-12-19
 */
public class PageData<T> {
    private long totalPages;
    private long totalElements;

    private int page;

    private int row;

    private boolean hasContent;

    private boolean hasNext;

    private boolean isFirst;

    private boolean isLast;

    private List<T> content;

    public PageData() {
    }

    public PageData(Page page) {
        this.page = page.getNumber();
        this.row = page.getSize();
        this.hasContent = page.hasContent();
        this.hasNext = page.hasNext();
        this.isFirst = page.isFirst();
        this.isLast = page.isLast();
        this.totalPages = page.getTotalPages();
        this.totalElements = page.getTotalElements();
    }

    public int getPage() {
        return page;
    }

    public void setPage(int page) {
        this.page = page;
    }

    public int getRow() {
        return row;
    }

    public void setRow(int row) {
        this.row = row;
    }

    public boolean isHasContent() {
        return hasContent;
    }

    public void setHasContent(boolean hasContent) {
        this.hasContent = hasContent;
    }

    public boolean isHasNext() {
        return hasNext;
    }

    public void setHasNext(boolean hasNext) {
        this.hasNext = hasNext;
    }

    public boolean isFirst() {
        return isFirst;
    }

    public void setFirst(boolean first) {
        isFirst = first;
    }

    public boolean isLast() {
        return isLast;
    }

    public void setLast(boolean last) {
        isLast = last;
    }

    public List<T> getContent() {
        return content;
    }

    public void setContent(List<T> content) {
        this.content = content;
    }

    public long getTotalPages() {
        return totalPages;
    }

    public void setTotalPages(long totalPages) {
        this.totalPages = totalPages;
    }

    public long getTotalElements() {
        return totalElements;
    }

    public void setTotalElements(long totalElements) {
        this.totalElements = totalElements;
    }
}
